﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Values.xaml" />
        <ResourceDictionary Source="GridViewColumnHeaderGripperStyle.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type GridViewColumnHeader}">

        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />

        <Setter Property="Background" Value="{StaticResource GridView.ColumnHeader.Background.Normal}" />
        <Setter Property="BorderBrush" Value="{StaticResource GridView.ColumnHeader.BorderBrush.Normal}" />
        <Setter Property="Foreground" Value="{StaticResource GridView.ColumnHeader.Foreground.Normal}" />

        <Setter Property="BorderThickness" Value="{StaticResource GridView.ColumnHeader.BorderThickness.Normal}" />
        <Setter Property="Padding" Value="6" />

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">

                    <Grid>
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Padding="{TemplateBinding Padding}">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              RecognizesAccessKey="True" />
                        </Border>
                        <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource GridViewColumnHeaderGripperStyle}" />
                    </Grid>

                    <ControlTemplate.Triggers>

                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{StaticResource GridView.ColumnHeader.Background.Hover}" />
                            <Setter Property="Foreground" Value="{StaticResource GridView.ColumnHeader.Foreground.Hover}" />
                            <Setter Property="BorderBrush" Value="{StaticResource GridView.ColumnHeader.BorderBrush.Hover}" />
                            <Setter Property="BorderThickness" Value="{StaticResource GridView.ColumnHeader.BorderThickness.Hover}" />
                        </Trigger>

                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Background" Value="{StaticResource GridView.ColumnHeader.Background.Pressed}" />
                            <Setter Property="Foreground" Value="{StaticResource GridView.ColumnHeader.Foreground.Pressed}" />
                            <Setter Property="BorderBrush" Value="{StaticResource GridView.ColumnHeader.BorderBrush.Pressed}" />
                            <Setter Property="BorderThickness" Value="{StaticResource GridView.ColumnHeader.BorderThickness.Pressed}" />
                        </Trigger>

                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource View.Foreground.Disabled}" />
                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>

            <Trigger Property="Role" Value="Padding">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                            <Border Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Padding="{TemplateBinding Padding}" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>

            <Trigger Property="Role" Value="Floating">
                <Setter Property="Opacity" Value="0.65" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                            <Canvas Name="PART_FloatingHeaderCanvas">
                                <!--<Rectangle Width="{TemplateBinding ActualWidth}"
                                           Height="{TemplateBinding ActualHeight}"
                                           Fill="Black"
                                           Opacity="0.1" />-->
                            </Canvas>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>

        </Style.Triggers>

    </Style>

</ResourceDictionary>